package me.send.data.service.service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import me.send.business.base.Pager;
import me.send.business.base.SendVariable;
import me.send.data.service.mapper.WithdrawMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class WithdrawService {
    @Autowired
    private WithdrawMapper withdrawMapper;
    
    // 使用分页查询
    public Map<String, Object> page(Pager pager, String phone,
	    int status, double num, String start, String end) {
	Map<String, Object> result = new HashMap<String, Object>();
	Map<String, Object> parameter = new HashMap<String, Object>();
	if (pager == null) {
	    pager = new Pager();
	}
	parameter.put("page", pager);
	parameter.put("phone", phone);
	parameter.put("status", status);
	parameter.put("num", num);
	parameter.put("start", start);
	parameter.put("end", end);
	List<Map<String, Object>> rows = withdrawMapper.page(parameter);
	Integer total = withdrawMapper.count(parameter);
	result.put(SendVariable.ROWS, rows);
	result.put(SendVariable.TOTAL, total);
	return result;
    }
    
    public Map<String, Object> allow(String brokerids) {
	Map<String, Object> result = new HashMap<String, Object>();
	result.put(SendVariable.DATA, SendVariable.SUCCESS);
	withdrawMapper.allow(brokerids);
	return result;
    }
}
